using System;
using System.Linq;
using NUnit.Framework;
using RFS.BizLogic;
using RFS.BizLogic.PaiShi;
using RFS.BizLogic.PaiShi.Ports;
using RFS.BizLogic.Sys;
using RFS.BizLogic.utils;
using RFS.Domain.PaiShi;
using ycx;

namespace IntergrationTest.PaiShi
{
    public class ItPriceManager
    {
        private IAntiObject _en;


        [SetUp]
        public void setup()
        {
            _en = Starter.StartApp(false);
        }


        [Test]
        public void T10_BuildTheWorkFlow_GivenaDB_returnsWorkFlow_YS()
        {
            var bn = "2024-12-13";
            var wm = _en.Get<IPriceManagerPort>();


            wm.GetPriceItems(DateTime.Parse(bn))
                .Echo();

            // Assert.True(wf.WorkFlowNode.Quantiy==46280 );
        }


        [Test]
        public void T10_testCatche()
        {
            var c1 = "2024/12/13_28282洛神45";
            var bn = "2024-12-13";
            var wm = _en.Get<IPriceManagerPort>();

            _en.Get<ILog>().NewLogAdded += (sender, s) => s.Echo();
            
            var st = 1.StartWatch();
            var p = wm.GetPrice(DateTime.Parse(bn), "28282", "洛神", 45,true);
            // p.Echo("firs");
            st.Report("first load");
            p = wm.GetPrice(DateTime.Parse(bn), "28282", "洛神", 45);
            st.Report("second load");
            Assert.NotNull(p);
            p.Echo();
            
        }
    }
}